package com.zlm.schedule;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author zlm
 * @date 2025/4/1
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss SSS");
        ScheduleService scheduleService = new ScheduleService();
        scheduleService.schedule(() -> {
            System.out.println(LocalDateTime.now().format(formatter) +" 任务1");
        }, 1000);

        Thread.sleep(1000);
        System.out.println("添加一个200ms的定时任务");
        scheduleService.schedule(() -> {
            System.out.println(LocalDateTime.now().format(formatter)+" 任务2");
        }, 2000);
    }

}
